<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <link rel="stylesheet" href="styles/style.css">
        <link rel="stylesheet" href="styles/theme/atom-one-dark.css">
        <title>例子16-JS进阶（二）</title>
    </head>
    <body>
        <pre>
            <code>
                    // 例子16

                    var person = {
                        name: 'Tom',
                        age: 20
                    }

                    function setName(obj) {  // 传入一个引用
                        obj = {};   // 将传入的引用指向另外的值
                        obj.name = 'Jerry';  // 修改引用的name属性
                    }

                    setName(person);
                    console.log(person.name);  // Tom 未被改变
            </code>
        </pre>
        <script src="scripts/libs/highlight.pack.js"></script>
        <script src="scripts/16.js"></script>
        <script>
            hljs.initHighlightingOnLoad();
        </script>
    </body>
</html>